<?php
/**new
 * Copyright (c) 2003-2012 John Willinsky
 * Ngoc Diep 
 */


import('classes.handler.Handler');
class DMgetHandler extends Handler {
	function DMgetHandler()	{
	}

	function RFR_DMDV(){
		
		$journal =& Request::getJournal();
		$journalid =$journal->getId();;

		$dmdvdao =& DAORegistry::getDAO('DMDVDAO');
		$dmdv_initial = Request::getUserVar("dmdv_initial");;
		$dmdvString = $dmdvdao->getSetting($journalid, $dmdv_initial);
		echo $dmdvString ;
	}


	function getTen_DMVT(){
		$dmvtdao =& DAORegistry::getDAO('DMVTDAO');
		$dmvt_ma = Request::getUserVar("ma");
		if (strlen($dmvt_ma)==0)
		{
			echo "";
			return;

		}
		$mysql = "SELECT * FROM dmvt where mavt='".$dmvt_ma."'";
		$result = & $dmvtdao->retrieve($mysql);
		$kq = "";

		while (!$result->EOF) {
			$row = $result->GetRowAssoc(false);
			$kq .= $row['tenvt']. '---'. $row['dvt']. '---'. $row['tk_dt'].'---'. $row['tk_ck'];
			$result->moveNext();
		}
		echo $kq ;
		return;
	}

	
	function getTen_DMKHO(){
		$dmkhodao =& DAORegistry::getDAO('DMKHODAO');
		$dmkho_ma = Request::getUserVar("ma");
		if (strlen($dmkho_ma)==0)
		{
			echo "";
			return;

		}
		$mysql = "SELECT * FROM dmkho where makho='".$dmkho_ma."'";
		$result = & $dmkhodao->retrieve($mysql);
		$kq = "";
		while (!$result->EOF) {
			$row = $result->GetRowAssoc(false);
			$kq .= $row['tenkho'];
			$result->moveNext();
		}
		echo $kq ;
		return;
	}

	function getTen_DMNT(){
		$dmntdao =& DAORegistry::getDAO('DMNTDAO');
		$dmnt_ma = Request::getUserVar("ma");
		if (strlen($dmnt_ma)==0)
		{
			echo "";
			return;

		}
		$mysql = "SELECT * FROM dmnt where mant='".$dmnt_ma."'";
		$result = & $dmntdao->retrieve($mysql);
		$kq = "";
		while (!$result->EOF) {
			$row = $result->GetRowAssoc(false);
			$kq .= $row['tennt'];
			$result->moveNext();
		}
		echo $kq ;
		return;
	}


	function getTen_DMTK(){
		$journal =& Request::getJournal();
		$journalid =$journal->getId();
		$dmtkdao =& DAORegistry::getDAO('DMTKDAO');
		$dmtk_ma = Request::getUserVar("dmtk_matk");
		if (strlen($dmtk_ma)==0)
		{
			echo "";
			return;

		}
		$mysql = "SELECT * FROM dmtk where matk='".$dmtk_ma."'";
		$result = & $dmtkdao->retrieve($mysql);
		$kq = "";
		while (!$result->EOF) {
			$row = $result->GetRowAssoc(false);
			$kq .= $row['tentk'];
			$result->moveNext();
		}
		echo $kq ;
		return;

	}

	function getTen_DMDV(){
		
		$journal =& Request::getJournal();
		$journalid =$journal->getId();;

		$dmdvdao =& DAORegistry::getDAO('DMDVDAO');

		$dmdv_ma = Request::getUserVar("dmdv_madv");
		if (strlen($dmdv_ma)==0)
		{
			echo "";
			return;

		}
		$mysql = "SELECT * FROM dmdv where madv='".$dmdv_ma."'";
		$result = & $dmdvdao->retrieve($mysql);
		$kq = "";
		while (!$result->EOF) {
			$row = $result->GetRowAssoc(false);
			$kq .= $row['tendv']. '---'. $row['masothue']. '---'. $row['diachi'].'---'. $row['daidien'];
			$result->moveNext();
		}
		echo $kq ;
		return;
	}

	function getTenOnly_DMDV(){
		
		$journal =& Request::getJournal();
		$journalid =$journal->getId();;

		$dmdvdao =& DAORegistry::getDAO('DMDVDAO');

		$dmdv_ma = Request::getUserVar("dmdv_madv");
		if (strlen($dmdv_ma)==0)
		{
			echo "";
			return;

		}
		$mysql = "SELECT * FROM dmdv where madv='".$dmdv_ma."'";
		$result = & $dmdvdao->retrieve($mysql);
		$kq = "";
		while (!$result->EOF) {
			$row = $result->GetRowAssoc(false);
			$kq .= $row['tendv'];
			$result->moveNext();
		}
		echo $kq ;
		return;
	}

function zgetTen_DMTK(){
		$journal =& Request::getJournal();
		$journalid =$journal->getId();
		$dmtkdao =& DAORegistry::getDAO('DMTKDAO');
		$dmtk_ma = Request::getUserVar("dmtk_matk");
		if (strlen($dmtk_ma)==0)
		{
			echo "";
			return;

		}
		$dmtk_ma .= '</a></b>-';
		$dmtkString = $dmtkdao->getSetting($journalid, 'tracuu');
		echo between ($dmtk_ma, '<br><b>', $dmtkString );
	}



}

?>
